<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="layui/css/layui.css">
		
		
	</head>
	<body>
		<div class="layui-row layui-col-space20" style="margin: 20px 10px;">
			<div class="layui-row layui-bg-gray">
				<span class="layui-breadcrumb">
					<a href="javascript:toIndex();"><span class="layui-icon layui-icon-home"></span> 首页</a>
					<a href=""><span class="layui-icon layui-icon-template-1"></span> 基础信息管理</a>
					<a href="">数据字典管理</a>
				</span>
			</div>
			<div class="layui-row">
				<form class="layui-form" action="">
					<div class="layui-col-md4">
						<span>字典项目</span>
						<div class="layui-input-inline">
							<input type="text" name="title" required lay-verify="required" autocomplete="off" class="layui-input">
						</div>
					</div>
					<div class="layui-col-md4">
						<span>所属类别</span>
						<div class="layui-input-inline">
							<select id="selectId">
								
							</select>
						</div>
					</div>
					<div class="layui-col-md1">
						<a class="layui-btn layui-btn-success" href="javascript:;">
							<span class="layui-icon layui-icon-search"></span>检索Search
						</a>
					</div>
				</form>
			</div>
          <div class="layui-card">
          	<div class="layui-card-body">
          		<table id="demo" lay-filter="test"></table>
          	</div>
          	<script type="text/html" id="buttonTpl">
          		<a class="layui-btn layui-bg-blue layui-btn-xs" lay-event="detail">编辑</a>
          		<a class="layui-btn layui-bg-warm layui-btn-xs" lay-event="detail">删除</a>
          	</script>
          </div>
         </div>
        <script type="text/javascript" src="js/jquery-3.4.1.min.js"></script>
		<script src="layui/layui.all.js"></script>
	<script>
			//注意：选项卡 依赖 element 模块，否则无法进行功能性操作
			layui.use(['element','form',"laypage",'table'],
			function() {
				var element = layui.element;
				var page = layui.laypage;
				var form = layui.form;
				var table=layui.table;
				//…
				page.render({
					elem:'page',
					count:50
					
				});
				 table.render({
				 	elem: '#demo'
                   ,height: 420
                   ,url: 'dataJSON/datatable.json' //数据接口
                   ,page: true //开启分页
                   ,limit:5
                   ,limits:[5,10,15,20]
                   ,loading:false
                   ,done:function(res,curr,count){
                   	console.log(res,curr,count);
                   }
                   ,cols: [[ //表头
                   {field: 'id', title: '编码值', width:260, sort: true, fixed: 'left'}
                   ,{field: 'showValue', title: '显示值', width:260}
                   ,{field: 'class', title: '所属类别', width:260, sort: true}
                   ,{field: 'desc', title: '备注信息', width:260}
                   ,{field: 'stadus', title: '操作', width:324,height:30,templet:'#buttonTpl'}
                   ]]
			});
			
			//下拉选数据
		$(function(){	
			$.ajax({
				type:"get",
				url:"dataJSON/selectDict.json",
				success:function(result){
					var seoption="";
					$.each(result.select,function(index,value){
						seoption+="<option>"+value+"</option>";
					})
					    console.log(seoption)
						$("#selectId").append(seoption);
						form.render();
				    }
			});
			})	
		});

		function toIndex(){
				$('#mainFrame').load('welcome.html');
			}
	</script>
</body>
</html>
